package com.trkj.service;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.trkj.dao.jpa.IJlCheckProjectDAO;
import com.trkj.pojos.JlCheckProject;


@Service
@Transactional
public class JlcheckprojectService {
	@Autowired
	private IJlCheckProjectDAO lCheckProjectDAO;
	public Map<String, Object> finCheckProjectpage(int page, int rows){
		PageRequest pr = new PageRequest(page - 1, rows);
		//获取当前页的记录
		List<JlCheckProject> list = lCheckProjectDAO.finCheckProjectpage(pr);
		//获取总的记录条数
		long total =lCheckProjectDAO.count();
		
		Map<String, Object> map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	public List<JlCheckProject> queryAll(){
		List<JlCheckProject> list=lCheckProjectDAO.queryAll();
		return list;		
	}
	
	//根据类别查找
	public List<JlCheckProject> checkProjKind(String sex){
		List<JlCheckProject> list=lCheckProjectDAO.checkProjKind(sex);
		return list;
	}
	//根据项目查找
	public List<JlCheckProject> checkProjPJ(String sex){
		List<JlCheckProject> list=lCheckProjectDAO.checkProjPJ(sex);
		return list;
	}
	public void addCheckProject(JlCheckProject s){
		lCheckProjectDAO.save(s);
	}
	public BigDecimal checkmoney(String cprProject){		
		return lCheckProjectDAO.checkmoney(cprProject);
	}
}
